package com.dailyblue.java.cloud.dept.controller;

import com.dailyblue.java.cloud.commons.bean.Dept;
import com.dailyblue.java.cloud.commons.util.JsonResult;
import com.dailyblue.java.cloud.dept.service.DeptService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/dept")
public class DeptController {
    @Resource
    private DeptService deptService;

    @GetMapping
    public JsonResult find() {
        return deptService.find();
    }

    @GetMapping("/{id}")
    public Dept find(@PathVariable int id) {
        return deptService.find(id);
    }
}
